package language.advanced.Concurrent;

import com.sun.media.sound.WaveFileReader;

public class waitTest extends Thread{


    public synchronized void k() throws InterruptedException {
        System.out.println("in k");
        wait();
        System.out.println("never in");
    }

    @Override
    public void run() {
        System.out.println("thread start");
        try {
            //k();
            Thread.sleep(1); // sleep will cause main thread exit,
            // but continue to compute will lead main wait
            while (true)
            System.out.println("k");
        } catch (InterruptedException e) {
            throw new RuntimeException(e);
        }
    }

    public static void main(String[] args) {
        for (int i = 0; i < 3; i++) {
            waitTest waitTest = new waitTest();
            waitTest.start();
            waitTest.interrupt();
        }

    }
}
